<?php

namespace app\school\controller;

use app\common\controller\BasicAdmin;

/**
 * Class Notice
 */
class Notice extends BasicAdmin
{
    /**
     * 公告管理
     */
    protected $model = 'NoticeModel';

    public function index(){
        $this->title = '公告管理';
        $school_id = session('school_user.school_id');
        return  $this->_query($this->model)
            ->where('school_id',$school_id)
            ->page();
    }

    /**
     * 添加
     */
    public function add()
    {
        $this->title = '添加';
        return $this->_form($this->model, 'form');
    }

    /**
     * 编辑
     */
    public function edit()
    {
        $this->title = '编辑';
        return $this->_form($this->model, 'form');
    }

    /**
     * 删除
     */
    public function del()
    {
        $this->_delete($this->model);
    }

    /**
     * 启用/关闭
     */
    public function upstatus(){
        $this->_save($this->model, [
            'status' => $this->request->request('status'),
        ],'id', ['id' => $this->request->request('id')]);
    }


}